package com.lyf.design.learn.designmodel.observer.test;

import java.util.LinkedList;
import java.util.List;

/**
 * @AUTHOR LYF
 * @DATE 2022/6/10
 * @VERSION 1.0
 * @DESC
 * 观察目标
 */
public abstract class Subject {
    private String name;
    List<Observer> observerList = new LinkedList<>();
    abstract void change();

    public List<Observer> getObserverList() {
        return observerList;
    }

    public void setObserverList(List<Observer> observerList) {
        this.observerList = observerList;
    }

    public void addObserver(Observer observer){
        observerList.add(observer);
    }
}
